package top.kaoshanji.p2ch15b;

/**
 * 代码清单-p2ch15b-462页a：集合点线程
 * author kaoshanji
 * ^_^
 * create time 2025/2/24 18:33
 */
public class AssemblePointThread extends Thread {

    private AssemblePoint ap;

    public AssemblePointThread(AssemblePoint ap) {
        this.ap = ap;
    }

    @Override
    public void run() {
        try {
            // 模拟先各自独立运行
            Thread.sleep((int) (Math.random() * 1000));

            ap.await();
            System.out.println("arrived");
            // ... 集合后执行其他操作
        } catch (InterruptedException e) {
            /// ///
        }
    }

}
